package com.mlk.reback.controller;


import com.mlk.busPram.po.EngBusParam;
import com.mlk.core.component.page.Pager;
import com.mlk.core.util.ServerResponse;
import com.mlk.reback.po.EngRebackTicketItem;
import com.mlk.reback.service.EngRebackTicketService;
import com.mlk.reback.vo.EngRebackTicketVO;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * @author trekxu
 * @since 2019-07-05
 */
@Controller
@RequestMapping("/eng/reback")
public class EngRebackTicketController {

    @Resource
    private EngRebackTicketService engRebackTicketService;

    /**
     * 返回首页
     * @return
     */
    @RequestMapping("index")
    public String index(){
        return "reback/reback";
    }


    /**
     * 分页数据查询
     * @param vo
     * @return
     */
    @RequestMapping("listPage")
    @ResponseBody
    public Pager listPage(EngRebackTicketVO vo){
        return this.engRebackTicketService.listPage(vo);
    }

    /**
     * 查看详情
     * @return
     */
    @ResponseBody
    @RequestMapping("ticketDetail")
    public Pager ticketDetail(String ticketId){
        return this.engRebackTicketService.ticketDetail(ticketId);
    }

    /**
     * 接收换购
     * @return
     */
    @RequestMapping("accept")
    @ResponseBody
    public ServerResponse accept(String id){
        return this.engRebackTicketService.accept(id);
    }


    /**
     * 完成换购
     * @param id
     * @return
     */
    @ResponseBody
    @RequestMapping("finish")
    public ServerResponse finish(String id){
        return this.engRebackTicketService.finish(id);
    }

    /**
     * 添加到业务参数
     * @return
     */
    @ResponseBody
    @RequestMapping("addBusParam")
    public ServerResponse addBusParam(EngBusParam param){
        return this.engRebackTicketService.addBusParam(param);
    }


    /**
     * 校正参数
     * @return
     */
    @RequestMapping("just")
    @ResponseBody
    public ServerResponse just(EngRebackTicketItem item){
        return this.engRebackTicketService.just(item);
    }
}

